import time

from selenium import webdriver
from selenium.webdriver import ActionChains

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")

# 初始化ActionChains:动作链条
action = ActionChains(driver)

# 找到要移动的元素
setting = driver.find_element('xpath', '//span[text()="设置"]')

# 鼠标悬停 move_to_element
ac = ActionChains(driver)
ac.move_to_element(setting).perform()
time.sleep(2)

# 点击高级搜索
adv_setting = driver.find_element('xpath', '//span[text()="高级搜索"]')
ac.click(adv_setting).perform()
time.sleep(2)

